/* **********************************************************
 * Copyright 2010 Dimitar Vangelovski
 *
 * This file is part of the Gens3 3D Engine.
 * 
 * The Gens3 3D Engine is free software; you can redistribute it and/or
 * modify it under the terms of version 2 of the GNU General Public
 * License as published by the Free Software Foundation.
 * 
 * The Gens3 3D Engine is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with the Gens3 3D Engine; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA
 * **********************************************************/


#pragma once

#include "ColorRGB.h"
#include <string>
#include <vector>

class CMapDiffuse;
class CSubMaterial;

class CMaterial
{
public:

	CMaterial();
	CMaterial(const CMaterial &other);
	CMaterial(std::string strMatName, float fMatTrans, int nNumSubMtls, CMapDiffuse* pMapDif, float fMatShine, float fMatShStrength, float fMatSelfIllum, CColorRGB matAmbient, CColorRGB matDiffuse, CColorRGB matSpecular);
	~CMaterial();

	void			SetMapDiffuse(CMapDiffuse * pMapDif) { m_pMapDiffuse = pMapDif; }
	void			SetSubMaterial(int nPos, CSubMaterial * pSubMat) { m_SubMaterialList[nPos] = pSubMat; }
	void			SetSubMaterialList(std::vector<CSubMaterial *> subMatList) { m_SubMaterialList = subMatList; }
	void			SetMaterialName(std::string strName) { m_strMaterialName = strName; }
	void			SetMaterialTransparency(float fMatTrans) { m_fMaterialTransparency = fMatTrans; }
	void			SetMaterialShine(float fMatShine) { m_fMaterialShine = fMatShine; }
	void			SetMaterialShineStrength(float fMatShStrength) { m_fMaterialShineStrength = fMatShStrength; }
	void			SetMaterialSelfIllum(float fMatSelfIllum) { m_fMaterialSelfIllum = fMatSelfIllum; }
	void			SetMaterialAmbient(CColorRGB matAmbient) { m_MaterialAmbient = matAmbient; }
	void			SetMaterialDiffuse(CColorRGB matDiffuse) { m_MaterialDiffuse = matDiffuse; }
	void			SetMaterialSpecular(CColorRGB matSpecular) { m_MaterialSpecular = matSpecular; }
	void			SetNumSubMtls(int iNumSubMtls) { m_nNumSubMtls = iNumSubMtls; }
	void			SetMaterialIndex(int iMatIndex) { m_nMaterialIndex = iMatIndex; }

	void			InsertSubMaterial(CSubMaterial * pSubMat) { m_SubMaterialList.push_back(pSubMat); }

	CSubMaterial *		GetSubMaterial(int nPos) const { return m_SubMaterialList[nPos]; }
	CMapDiffuse *		GetMapDiffuse() const { return m_pMapDiffuse; }
	std::string		GetMaterialName() const { return m_strMaterialName; }
	float			GetMaterialTransparency() const { return m_fMaterialTransparency; }
	float			GetMaterialShine() const { return m_fMaterialShine; }
	float			GetMaterialShineStrength() const { return m_fMaterialShineStrength; }
	float			GetMaterialSelfIllum() const { return m_fMaterialSelfIllum; }
	CColorRGB		GetMaterialAmbient() const { return m_MaterialAmbient; }
	CColorRGB		GetMaterialDiffuse() const { return m_MaterialDiffuse; }
	CColorRGB		GetMaterialSpecular() const { return m_MaterialSpecular; }
	int				GetNumSubMtls() const { return m_nNumSubMtls; }
	int				GetMaterialIndex() const { return m_nMaterialIndex; }
	std::vector<CSubMaterial *>	GetSubMaterialList() const { return m_SubMaterialList; }

private:
	std::vector<CSubMaterial *>	m_SubMaterialList;
	CMapDiffuse *			m_pMapDiffuse;
	std::string			m_strMaterialName;
	float				m_fMaterialTransparency;
	float				m_fMaterialShine;
	float				m_fMaterialShineStrength;
	float				m_fMaterialSelfIllum;
	CColorRGB			m_MaterialAmbient;
	CColorRGB			m_MaterialDiffuse;
	CColorRGB			m_MaterialSpecular;
	int				m_nNumSubMtls;
	int				m_nMaterialIndex;
};

